home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / Libraries / DCLAP 4j / DClap / DWindow.h < prev   
Encoding:
Text File  |  1995-12-17  |  3.8 KB  |  121 lines  |  [TEXT/R*ch]

  1. // DWindow.h
  2. // d.g.gilbert
  3.  
  4. #ifndef _DWINDOW_
  5. #define _DWINDOW_
  6.  
  7. #include "Dvibrant.h"
  8. #include "DView.h"
  9. #include "DMethods.h"
  10.  
  11. class DDialogText;
  12. class DList;
  13. class DFindDialog;
  14. class DFile;
  15.  
  16.  
  17. class DWindow : public DView
  18. {    
  19. public:
  20.     enum WindowStyles { document, fixed, frozen, round, alert, modal, floating, shadow, plain };
  21.     enum WindowConst { kDontFreeOnClose = false, kFreeOnClose = true };
  22.     Nlm_WindoW            fWindow;
  23.     DDialogText*         fEditText; // for use w/ cut/copy/paste/etc
  24.     DPrintHandler*    fPrintHandler;
  25.     DSaveHandler*        fSaveHandler;
  26.     Boolean                    fModal, fOkay, fFreeOnClose;
  27.     DFindDialog        * fFindDlog;
  28.  
  29.     DWindow(long id, DTaskMaster* itsSuperior, WindowStyles style,
  30.                     short width = -5, short height = -5, short left = -50, short top = -20, 
  31.                     char* title = NULL, Nlm_Boolean freeOnClose= kFreeOnClose);
  32.     DWindow(long id, DTaskMaster* itsSuperior); // user of this MUST call Initialize()
  33.     virtual ~DWindow();
  34.  
  35.     virtual void InitWindow(WindowStyles style = fixed, 
  36.                     short width = -5, short height = -5, short left = -50, short top = -20, 
  37.                     char* title = NULL, Nlm_Boolean freeOnClose= kFreeOnClose);
  38.                     
  39.     virtual void Open();
  40.     virtual void Hide(); 
  41.     virtual void Close();
  42.     virtual void CloseAndFree();
  43.     virtual    void AddOkayCancelButtons( 
  44.             long okayId = cOKAY, char* okayName = "Okay",
  45.             long cancelId = cCANC, char* cancelName = "Cancel");
  46.  
  47.     virtual Boolean IsMyAction(DTaskMaster* action); // traps OKAY, CANC messages
  48.     virtual Boolean PoseModally();     // not really modal, just open/eventloop til close/return okayHit 
  49.     virtual void         OkayAction();     // override to handle 'OKAY' message
  50.  
  51.     virtual void PrintDoc();
  52.     virtual void SaveDoc(DFile* f);
  53.         
  54.     virtual void  Select();         // override
  55.         // activate()/deactivate() are not useful in x-win
  56.         // need an equivalent for all win systems, ???? what 
  57.     virtual void  Activate();
  58.     virtual void  Deactivate();
  59.     
  60.     virtual void  ResizeWin();
  61.     virtual void  CalcWindowSize();
  62.     
  63.     Boolean  HasEditText() { return (fEditText != NULL); }
  64.     void  SetEditText(DDialogText* theText) { fEditText= theText; }
  65.  
  66.     virtual void Erase();
  67.     virtual void Use();                    // useful way to activate a window ! 
  68.     virtual Boolean IsUsing();    // ??
  69.     virtual void Realize();            // == Nlm_DoShow(), which is good for what?? 
  70.     //virtual Boolean InFront();    // Mac only
  71.     virtual void SendToBack();  
  72.     virtual void BringToFront();  
  73. };
  74.  
  75.  
  76.  
  77.  
  78. class    DWindowManager    : public    DObject
  79. {
  80.     DList*    fWindows;
  81.     DWindow* fAppWindow;    // main-menu window for app, non-mac systems
  82.     DWindow* fLastActive;    // last current, non-main window (? non-modal...)
  83. public:
  84.     DWindowManager();
  85.     virtual ~DWindowManager();
  86.     
  87.     virtual void AddWindow(DWindow* theWin);
  88.     virtual void DeleteWindow(DWindow* theWin, Nlm_Boolean postDeleteTask = true);
  89.     virtual void SetAppWindow(DWindow* theWin);
  90.     virtual DWindow* GetAppWindow();
  91.     virtual void SetCurrent(DWindow* theWin);
  92.     virtual void UnsetCurrent(DWindow* theWin);
  93.     virtual DWindow*    CurrentWindow();    // all, but may not be accurate?
  94.     virtual DList* GetWindowList() { return fWindows; }
  95.  
  96.     virtual void SendToBack(DWindow* theWin = NULL); // if null, frontwin
  97.     virtual void BringToFront(DWindow* theWin = NULL); // if null, lastwin
  98.  
  99.             // these are not all useful in all win systems
  100.             // consolidate as one function CurrentWindow() that
  101.             // always returns the app's front/current/active window
  102.     //virtual DWindow*    FrontWindow();        // Mac, MSWin, NOT xwin
  103.     //virtual DWindow*    ActiveWindow();        // Mac, MSWin, NOT xwin
  104.  
  105.     virtual DWindow* WhichWindow(Nlm_PoinT mouse);     // Mac, MSWin, NOT xwin
  106.     virtual Boolean    InWindow(Nlm_PoinT mouse);             // Mac, MSWin, NOT xwin
  107.  
  108.     virtual DWindow* SavePort(DView* newport);
  109.     virtual void RestorePort(DWindow* savedwindow);
  110.     
  111.     virtual DDialogText* CurrentDialogText();
  112.  
  113.     virtual void    UpdateDisplays();
  114. };
  115.  
  116.  
  117. extern    DWindowManager*    gWindowManager;
  118.  
  119.  
  120. #endif
  121.